<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>call native app</title>
</head>
<body>
<script>
function onMesg(msg){
	var showmsg=document.getElementById("showmsg");
	showmsg.value=showmsg.value+"<br>"+"return:"+msg;
}
function initNA(){
	window.onNativeMsg(onMesg);
	showMSG("init!");
}
function callNA(){
	var params=document.getElementById("params");
	window.post2Native(params.value);
	showMSG("input:"+params.value);
}
function showMSG(msg){
    document.getElementById("showmsg").value = msg;
}
</script>
<form name="formNA">
<input type="button" value="init" onclick="initNA()">
<br>
<input id="params" name="params" type="text">
<input type="button" value="call" onclick="callNA()">
<br>
<textarea id="showmsg" name="showmsg" rows="10" cols="30">
</textarea>
</form>
</body>
</html>